let firstCount = 0
export default {
  // vue instance config
  methods: {
    refreshSystemSelector(){},//刷新系统选择器的方法
    // 由于每次取值时要求是最新的sessionStorage值，所以不能使用计算属性（它有缓存，不会及时更新）
    getCurSystem () {
      return {
        id: window.sessionStorage.getItem('curSystemId'),
        name: window.sessionStorage.getItem('curSystemName')
      }
    },
    setCurSystem (value) {
      window.sessionStorage.setItem('curSystemId', value.id || '')
      window.sessionStorage.setItem('curSystemName', value.name)
      firstCount++
      if (firstCount > 1) {
        this.$emit('system-or-time-change', {
          curSystem: this.getCurSystem(),
          curTime: this.getCurTime()
        })
      }
    },
    getCurTime () {
      return {
        id: window.sessionStorage.getItem('curTimeId'),
        name: window.sessionStorage.getItem('curTimeName')
      }
    },
    setCurTime (value) {
      window.sessionStorage.setItem('curTimeId', value.id)
      window.sessionStorage.setItem('curTimeName', value.name)
      firstCount++
      if (firstCount > 1) {
        this.$emit('system-or-time-change', {
          curSystem: this.getCurSystem(),
          curTime: this.getCurTime()
        })
      }
    }
  },
  computed: {}
}